'use strict'

class collect {

  constructor () {
    //param默认就是/:id，若要改变路由，则可以设置此属性，比如设置为/:name
    //this.param = '/:id'
  }
  async get(c) {
    let u=c.box.user;
    let sqltext = `SELECT * FROM mycollection WHERE open_Id=$1`;
    let r = await c.service.psql.query(sqltext,[u.openid]);
    console.log(r.rows);
    c.send(JSON.stringify(r.rows));
  }
  async list(c){
    let sqltext = `SELECT * FROM mycollection`;
    let r = await c.service.psql.query(sqltext);
    console.log(r.rows);
    c.send(JSON.stringify(r.rows));
  }

}

module.exports = collect